﻿<?php
require_once("../public_files/fenye.php");
require_once("../public_files/show_search.php");
require_once("../public_files/conn.php");
require_once("../public_files/rep_spe_cha.php");


$str_id=$_POST['str_id'];
$page=$_POST['page'];
$type=$_POST['type'];
$pagenum=$_POST['pagenum'];
		
		$list=explode("|",$str_id);
		$list_id1=explode("@",substr($list[0],0));
		$list_id2=explode("@",substr($list[1],0));
  
			if($type==0){
				$table="official_list_name";
				$listname_id=$list_id1;
			}else{
				$table="user_list_name";
				$listname_id=$list_id2;
			}
			$page=isset($_POST['page'])?intval($_POST['page']):1;
			$num=10;
			$total=count($listname_id);
			$pagenum=ceil($total/$num);
			If($page>$pagenum || $page == 0){
				echo "error : Can Not Found The page .";
				exit;
			}
			if($total<$num){
			$num=$total;
			}
		
			$offset=($page-1)*$num;
			$end=$num*$page;
			if($page==$pagenum){
				$end=($total%$num+$offset);
			}
			
			for($i=$offset;$i<$end;$i++){
			$id=$listname_id[$i];
			$sql="select * from ".$table." where id='$id'";
			$results=mysql_query($sql);
			$rows=mysql_fetch_array($results);
				if($rows['user_id']==0){
				$user_name="游客";
				}else{
				
				$result=mysql_query("select * from userinf where id='".$rows['user_id']."'")or die(mysql_error());
				$row=mysql_fetch_array($result);
				$user_name=$row['username'];
				
				}
				if($type==0){
				?>
					<div class="pl_1">
						<div class="pic">
							<img src="<?php echo $rows['img_path']; ?>">
						</div>
						<div class="list_1_content">
							<?php echo "<a style='color:#444;font-size:23px;' href='MusicListContent.php?listname_id=$rows[id]&type=0&sort_id=$rows[list_sort_id]' onclick=add_browse_o($rows[id])>".$rows['list_name']."</a>";?><br/>
							<span style="color:#777;font-size:12px;">更新时间 : </span><span style="color:#777;font-size:12px;"> 每周一 12:30 a.m</span>
						</div>
					</div>
				<?php
				}else{?>
				<div class="pl_1">
							<div class="pic">
								<img style="width:48px;height:48px;"src="<?php echo $rows['img_path']; ?>">
							</div>
							<div class="list_1_content">
								<div class="list_name">
									<?php echo "<a style='color:#444;font-size:21px;' href='MusicListContent.php?listname_id=$rows[id]&type=1&sort_id=$rows[list_sort_id]' onclick='add_browse_u(".$rows['id'].")'>".$rows['list_name']."</a>";?><br/>
								</div>
								<div class="user_name">
									<span style="color:#777;font-size:12px;">发布时间 : </span><span style="color:#777;font-size:12px;"><?php echo $rows['create_time']; ?></span>
									<span class="un_useful_2">@:</span><a href="#" ><?php echo $user_name; ?></a>
								</div>
							</div>
				</div>				
				
			<?php	
				
				}
					}
			echo '<div class="feiye">';
			 fenyexianshi($page,$pagenum,$type,"search_fenye",$str_id,"-5","-5");////////////////逻辑分页、分块
			echo '</div>'; 

			


?>